from typing import Optional

from sqlmodel import Field

from src.base.beans import PageParam
from src.domain.base_model import TenantModel


class SysPostBase(TenantModel):
    post_id: Optional[int] = Field(primary_key=True, description="岗位序号", sa_column_kwargs={"comment": "岗位序号"})
    post_name: Optional[str] = Field(description="岗位名称", sa_column_kwargs={"comment": "岗位名称"})
    post_code: Optional[str] = Field(description="岗位编码", sa_column_kwargs={"comment": "岗位编码"})
    dept_id: Optional[int] = Field(primary_key=True, description="部门序号", sa_column_kwargs={"comment": "部门序号"})


class SysPost(SysPostBase, table=True):
    __tablename__ = "sys_post"
    __table_args__ = {'extend_existing': True, 'comment': '岗位表'}


class SysPostReq(SysPostBase, PageParam):
    pass


class SysPostResp(SysPostBase):
    pass
